package string;

/**
 * [a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
 */
public class MatchMethod {
    public static void main(String[] args) {
        String email = "2722100181@qq.com";
        String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        Boolean match = email.matches(regex);
        if (match){
            System.out.println("正确邮箱");
        }else{
            System.out.println("邮箱格式错误");
        }
    }
}
